<%--
    Document   : index
    Created on : 09 Apr 11, 0:21:47
    Author     : asus
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="database.db" %>
<%@page import="bean.*" %>
<%@page import="chat.*" %>
<%@page import="java.util.ArrayList" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">


<%
    ChatRoomList roomList = (ChatRoomList)application.getAttribute("roomList");
    if (roomList==null)
    {
        roomList = new ChatRoomList();
    }
    int globalRoomCounter = 0;
    application.setAttribute("roomList", roomList);
    application.setAttribute("globalRoomCounter", globalRoomCounter);

    /*
     * dummy data
     */
    //String desiredRoomName;
    //String desiredRoomDescr;
    /*get room number from user session*/
    //++globalRoomCounter;
    //application.setAttribute("globalRoomCounter", globalRoomCounter);
    //session.setAttribute("selectedRoom", globalRoomCounter);
    //get the name of the room desired to create
    //desiredRoomName = "roomdummy";
    //get the description of the room desired to create
    /*desiredRoomDescr = "hanya room dummy biasa";
    ChatRoom room = new ChatRoom(globalRoomCounter,1, desiredRoomName, desiredRoomDescr);
    if (room.chatterExists("edwin")==false){
    Chatter usernya = new Chatter("edwin", "male", 0);
    room.addChatter(usernya);}
    if (room.chatterExists("athia")==false){
    Chatter userlain = new Chatter("athia", "female", 0);
    room.addChatter(userlain);}*/
    /*
    Add New Room
    */
    //roomList.addRoom(room);

    //application.setAttribute("roomList", roomList);

    db.setConnection();
    //save session id
%>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="css/style.css"/>
        <link rel="stylesheet" type="text/css" href="css/dump.css"/>
        <script type="text/javascript" src="js/validator.js"></script>
        <title>popoChat</title>
        <link rel="stylesheet" type="text/css" href="../css/style.css"/>
        <title>Registration</title>
    </head>

    <body>
        <div class="main_wrapper">
            <div class="login">
                <div class="logininput">
                    <div class="loginlabel1">Sign in here</div>
                    <div class="login_wrapper">
                        <form method="POST" action="login">
                            <div class="loginfield">
                                <div class="loginlabel">Username</div>
                                <div class="inputlogin"><input type="text" name="username_login" id="username_login"></div>
                            </div>
                            <div class="loginfield">
                                <div class="loginlabel">Password </div>
                                <div class="inputlogin"><input type="password" name="password_login" id="password_login"></div>
                            </div>
                            <input type="submit" class="signinsubmit" name="submit" onclick="validateLogIn()" value="Submit"/>
                        </form>
                    </div>
                </div>
            </div>

            <div class="register">
                <form class="dark_form" method="post" action="adduser">
                    <div class="headerregister">Don't have an account?</div>
                    <div class="headerregister">Register Now for Free!</div>
                    <div class="field">
                        <div class="ilabel">Name</div>
                        <div class="iinput">
                            <input type="text" class="itext" id="name" name="name" onchange="validateName()"/>
                            <div class="ireq">Min. 5 characters, only space and alphabet.</div>
                        </div>
                        <div class="iinfo" id="nama_info"></div>
                    </div>

                    <div class="field">
                        <div class="ilabel">Username</div>
                        <div class="iinput">
                            <input type="text" class="itext" id="username" name="username" onchange="validateUname()"/>
                            <div class="ireq">Min. 5 characters, Alphanumeric and dot ('.').</div>
                        </div>
                        <div class="iinfo" id="uname_info"></div>
                    </div>

                    <div class="field">
                        <div class="ilabel">Password</div>
                        <div class="iinput">
                            <input type="password" class="itext" id="pw" name="password" onchange="validatePw()"/>
                            <div class="ireq">Min. 6 characters.</div>
                        </div>
                        <div class="iinfo" id="pw_info"></div>
                    </div>

                    <div class="field">
                        <div class="ilabel">Re-type password</div>
                        <div class="iinput">
                            <input type="password" class="itext" id="pwa" onchange="validatePwa()"/>
                            <div class="ireq">Must be equal to Password.</div>
                        </div>
                        <div class="iinfo" id="pwa_info"></div>
                    </div>

                    <div class="field">
                        <div class="ilabel">E-Mail</div>
                        <div class="iinput">
                            <input type="text" class="itext" id="email" name="email" value="" onchange="validateEmail()"/>
                            <div class="ireq">Min. 5 characters, alphanumeric and dot ('.').<br/>Top level domain should contain at least 2 characters.</div>
                        </div>
                        <div class="iinfo" id="email_info"></div>
                    </div>

                    <div class="subm_wrap">
                        <input type="submit" class="isubmit" name="reset" onclick="" value="Reset"/>
                        <input type="submit" class="isubmit" name="submit" onclick="validateRegistration()" value="Submit"/>
                    </div>
                </form>
            </div>
            
            <div id="footer">
                Created by Ana - Edwin - Athia
            </div>
        </div>
    </body>
</html>
<% db.unsetConnection(); %>